]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Take a MetaWindow as argument to setReservedSlot()
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 3 Sep 2014 14:03:24 +0000 (16:03 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 11 Sep 2014 22:57:40 +0000 (00:57 +0200)
And use it to lookup the local WindowClone that applies. Otherwise,
WorkspaceThumbnail.WindowClone objects may be mistakenly set, which
are not usable interchangeably with Workspace.WindowClone ones. This
may lead to several misbehaviors as fields available in the second
object but not in the first one are accessed, some those undefined
values get used in math ops, which result in NaNs over the place.

Likewise, the similar functions in WorkspacesViewBase subclasses take
now MetaWindow arguments too.

https://bugzilla.gnome.org/show_bug.cgi?id=735972

js/ui/workspace.js
js/ui/workspacesView.js

index 66058b93d0a7e87825325cf78489214b0e1290c9..cee9ae538d99203d4e2616e7a49bdd45bdcf81a6 100644 (file)
@@ -1209,14 +1209,18 @@ const Workspace = new Lang.Class({
         return this._windows.length == 0;
     },
 
-    setReservedSlot: function(clone) {
-        if (this._reservedSlot == clone)
+    setReservedSlot: function(metaWindow) {
+        if (this._reservedSlotWindow == metaWindow)
             return;
 
-        if (clone && this.containsMetaWindow(clone.metaWindow))
-            clone = null;
+        if (!metaWindow || this.containsMetaWindow(metaWindow)) {
+            this._reservedSlotWindow = null;
+            this._reservedSlot = null;
+        } else {
+            this._reservedSlotWindow = metaWindow;
+            this._reservedSlot = this._windows[this._lookupIndex(metaWindow)];
+        }
 
-        this._reservedSlot = clone;
         this._recalculateWindowPositions(WindowPositionFlags.ANIMATE);
     },
 
index 004ac81ae079e9715e28b50b400680f1923005a5..9e75661f671c4a0a3eb5cfe68def1504e102a554 100644 (file)
@@ -65,7 +65,7 @@ const WorkspacesViewBase = new Lang.Class({
 
     _dragBegin: function(overview, clone) {
         this._inDrag = true;
-        this._setReservedSlot(clone);
+        this._setReservedSlot(clone.metaWindow);
     },
 
     _dragEnd: function() {
@@ -127,9 +127,9 @@ const WorkspacesView = new Lang.Class({
                                           Lang.bind(this, this._activeWorkspaceChanged));
     },
 
-    _setReservedSlot: function(clone) {
+    _setReservedSlot: function(window) {
         for (let i = 0; i < this._workspaces.length; i++)
-            this._workspaces[i].setReservedSlot(clone);
+            this._workspaces[i].setReservedSlot(window);
     },
 
     _syncFullGeometry: function() {
@@ -366,8 +366,8 @@ const ExtraWorkspaceView = new Lang.Class({
         this.actor.add_actor(this._workspace.actor);
     },
 
-    _setReservedSlot: function(clone) {
-        this._workspace.setReservedSlot(clone);
+    _setReservedSlot: function(window) {
+        this._workspace.setReservedSlot(window);
     },
 
     _syncFullGeometry: function() {